package com.jeecms.wicool.manager.car.impl;



import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeecms.cms.entity.main.CmsUser;
import com.jeecms.common.hibernate3.Updater;
import com.jeecms.common.page.Pagination;
import com.jeecms.wicool.dao.car.CarOrderDao;
import com.jeecms.wicool.entity.car.CarOrder;
import com.jeecms.wicool.manager.car.CarOrderMng;

@Service
@Transactional
public class CarOrderMngImpl implements CarOrderMng {
	
	private CarOrderDao dao;
	@Autowired
	public void setDao(CarOrderDao dao) {
		this.dao = dao;
	}
	
	@Transactional(readOnly = true)
	public Pagination getPage(String loginName,String userName,Short orderType,String orderTimeStart,String orderTimeEnd,Short status,int pageNo, int pageSize,CmsUser user) {
		Pagination page = dao.getPage(loginName,userName, orderType, orderTimeStart,orderTimeEnd, status, pageNo, pageSize, user);
		return page;
	}
	@Override
	public CarOrder findById(Integer id) {
		CarOrder entity = dao.findById(id);
		return entity;
	}

	@Override
	public CarOrder update(CarOrder bean) {
		Updater<CarOrder> updater = new Updater<CarOrder>(bean);
		bean = dao.updateByUpdater(updater);
		return bean;
	}

	@Override
	public CarOrder save(CarOrder bean) {
		dao.save(bean);
		return bean;
	}

	@Override
	public CarOrder deleteById(Integer id) {
		CarOrder bean = dao.deleteById(id);
		return bean;
	}
	@Override
	public CarOrder[] deleteByIds(Integer[] ids) {
		CarOrder[] beans = new CarOrder[ids.length];
		for (int i = 0,len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}
	@Override
	public List<CarOrder> getAll(CmsUser user) {
		return dao.getAll(user);
	}
	@Override
	public List<CarOrder> getCarOrderList(Short orderType,String orderTimeStart,String orderTimeEnd,CmsUser user){
		return dao.getCarOrderList(orderType, orderTimeStart, orderTimeEnd, user);
	}
}